using System.Text;

namespace etcetera.Mvc.UI.Toolbar
{
    public class ToolbarPageInput : ToolbarItem
    {
        public override string GetValue()
        {
            PagerToolStrip toolStrip = (PagerToolStrip)Toolbar.ToolStrip;
            string id = toolStrip.Id;

            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("<div class='{0}'>", "tCtrl");

            sb.AppendFormat("Page <input name='{0}' id='{0}' type='text' size='3' value='{1}'> of <span id='{2}'>{3}</span>",
                            id + "PN",
                            toolStrip.CurrentPage,
                            id + "PC",
                            toolStrip.LastPage);

            sb.AppendFormat("</div>");

            return sb.ToString();
        }
    }
}